//定义全局加载的文件
import React from 'react'
import * as UI from 'antd-mobile'
import * as ICON from 'antd-mobile-icons'
import request from '@/services/request'

//React命名空间下创建自定义属性
React.UI = UI
React.ICON = ICON

// 成功和失败提醒方法
React.toast = (msg: string, callback?: any, type?: string) => 
{
    React.UI.Toast.show({
        icon: type ? type : 'success',
        content: msg,
        duration: 1500,
        afterClose: () => 
        {
            if(!callback) return;

            if(typeof callback === "string") callback === "back" ? React.navigate(-1) : React.navigate(callback)
            else callback()
        }
    })
}

export default {}